<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>阿里Java编码铁律</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-shadow {
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .card-shadow:hover {
            transform: translateY(-5px);
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
        }
        
        .code-block {
            background: #1e1e1e;
            border-radius: 12px;
            overflow: hidden;
            position: relative;
        }
        
        .code-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 40px;
            background: #2d2d2d;
            display: flex;
            align-items: center;
            padding: 0 15px;
        }
        
        .code-block pre {
            margin-top: 40px;
            padding: 20px;
            overflow-x: auto;
            color: #d4d4d4;
            font-size: 14px;
            line-height: 1.6;
        }
        
        .section-number {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 20px;
            margin-right: 20px;
            flex-shrink: 0;
        }
        
        .highlight-text {
            background: linear-gradient(to right, #667eea, #764ba2);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-weight: 600;
        }
        
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            margin-top: -0.2rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center animate-fadeInUp">
            <h1 class="text-5xl md:text-6xl font-bold mb-6">
                <i class="fas fa-code mr-4"></i>
                阿里Java编码铁律
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                从变量命名到架构设计，10条保命法则让你的代码脱胎换骨
            </p>
            <div class="flex flex-wrap justify-center gap-4 text-lg">
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-user-tie mr-2"></i>P8导师亲授
                </span>
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-shield-alt mr-2"></i>避免百万级损失
                </span>
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-rocket mr-2"></i>代码质量飞跃
                </span>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-6xl mx-auto px-6 py-12">
        <!-- Introduction Card -->
        <div class="bg-white rounded-2xl card-shadow p-8 mb-12 animate-fadeInUp">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">我</span>见过最离谱的变量命名是<code class="bg-gray-100 px-2 py-1 rounded text-purple-600">a1</code>和<code class="bg-gray-100 px-2 py-1 rounded text-purple-600">data2</code>——这简直是在用摩斯密码写Java！直到被阿里P8导师按头教育后，我才明白：<strong class="highlight-text">真正的高手代码，连空行都是艺术</strong>。
            </p>
            
            <div class="mt-8 bg-gradient-to-r from-purple-50 to-blue-50 rounded-xl p-6">
                <h3 class="text-xl font-bold mb-4 text-gray-800">
                    <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                    本文揭秘我在阿里学到的10条保命铁律：
                </h3>
                <ul class="space-y-3">
                    <li class="flex items-start">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">一个3000行的类如何被我们拆到300行</span>
                    </li>
                    <li class="flex items-start">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">用异常处理避免百万级资金损失的真实案例</span>
                    </li>
                    <li class="flex items-start">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">让代码自己说话的命名魔法</span>
                    </li>
                </ul>
            </div>
        </div>

        <!-- Concept Map -->
        <div class="bg-white rounded-2xl card-shadow p-8 mb-12">
            <h3 class="text-2xl font-bold mb-6 text-center">
                <i class="fas fa-sitemap text-purple-600 mr-3"></i>
                编码规范体系全景图
            </h3>
            <div class="mermaid">
                graph TD
                    A[Java编码规范] --> B[命名规范]
                    A --> C[代码结构]
                    A --> D[异常处理]
                    A --> E[测试规范]
                    A --> F[工具支持]
                    
                    B --> B1[变量命名]
                    B --> B2[方法命名]
                    B --> B3[类命名]
                    
                    C --> C1[单一职责]
                    C --> C2[方法长度]
                    C --> C3[类大小]
                    
                    D --> D1[精确捕获]
                    D --> D2[日志记录]
                    D --> D3[异常恢复]
                    
                    E --> E1[单元测试]
                    E --> E2[覆盖率]
                    E --> E3[Mock测试]
                    
                    F --> F1[CheckStyle]
                    F --> F2[SonarLint]
                    F --> F3[SpotBugs]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                    style B fill:#9f7aea,stroke:#fff,stroke-width:2px,color:#fff
                    style C fill:#9f7aea,stroke:#fff,stroke-width:2px,color:#fff
                    style D fill:#9f7aea,stroke:#fff,stroke-width:2px,color:#fff
                    style E fill:#9f7aea,stroke:#fff,stroke-width:2px,color:#fff
                    style F fill:#9f7aea,stroke:#fff,stroke-width:2px,color:#fff
            </div>
        </div>

        <!-- Rule 1 -->
        <div class="bg-white rounded-2xl card-shadow p-8 mb-8">
            <div class="flex items-center mb-6">
                <div class="section-number">1</div>
                <h2 class="text-3xl font-bold text-gray-800">你的变量名暴露了编程年限</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-6 mb-6">
                <div>
                    <h3 class="text-xl font-semibold mb-3 text-red-600">
                        <i class="fas fa-times-circle mr-2"></i>反面教材
                    </h3>
                    <div class="code-block">
                        <pre><code>public void pdx(int a, String b) { 
    // 快递处理？怕得罪谁不敢写全称？
    List&lt;Object&gt; list = new ArrayList&lt;&gt;(); 
    // 这个list装的是啥？
    // ... 200行后
    list.add(123); 
    // 夭寿啦！数字往Object列表里塞
}</code></pre>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-xl font-semibold mb-3 text-green-600">
                        <i class="fas fa-check-circle mr-2"></i>正确姿势
                    </h3>
                    <div class="code-block">
                        <pre><code>// 物流轨迹更新
public void updateDeliveryTracking(
    String trackingNumber, 
    DeliveryStatus status) {
    
    List&lt;DeliveryEvent&gt; deliveryEvents = 
        new ArrayList&lt;&gt;(10);
    deliveryEvents.add(
        new DeliveryEvent(
            LocalDateTime.now(), 
            status
        )
    );
}</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-purple-50 rounded-xl p-6">
                <h4 class="text-lg font-semibold mb-3">
                    <i class="fas fa-key text-purple-600 mr-2"></i>命名三要素
                </h4>
                <div class="grid md:grid-cols-3 gap-4">
                    <div class="bg-white rounded-lg p-4">
                        <h5 class="font-semibold text-purple-700 mb-2">见名知意</h5>
                        <p class="text-sm text-gray-600">如 <code class="bg-gray-100 px-2 py-1 rounded">calculateOrderTotal</code> 代替 <code class="bg-gray-100 px-2 py-1 rounded">calc</code></p>
                    </div>
                    <div class="bg-white rounded-lg p-4">
                        <h5 class="font-semibold text-purple-700 mb-2">杜绝缩写</h5>
                        <p class="text-sm text-gray-600"><code class="bg-gray-100 px-2 py-1 rounded">custAddr</code> 不如 <code class="bg-gray-100 px-2 py-1 rounded">customerAddress</code></p>
                    </div>
                    <div class="bg-white rounded-lg p-4">
                        <h5 class="font-semibold text-purple-700 mb-2">统一术语</h5>
                        <p class="text-sm text-gray-600">全系统使用 <code class="bg-gray-100 px-2 py-1 rounded">discountRate</code> 或 <code class="bg-gray-100 px-2 py-1 rounded">rebateRatio</code> 二选一</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Rule 2 -->
        <div class="bg-white rounded-2xl card-shadow p-8 mb-8">
            <div class="flex items-center mb-6">
                <div class="section-number">2</div>
                <h2 class="text-3xl font-bold text-gray-800">别让类膨胀成代码肿瘤</h2>
            </div>
            
            <p class="text-lg text-gray-700 mb-6 leading-relaxed">
                某电商平台的<code class="bg-gray-100 px-2 py-1 rounded text-purple-600">OrderService</code>类曾重达3800行，直到某次大促时触发了JVM方法区OOM。我们通过<strong class="highlight-text">领域拆分</strong>将其瘦身：
            </p>
            
            <div class="grid md:grid-cols-2 gap-6 mb-6">
                <div>
                    <h3 class="text-lg font-semibold mb-3 text-red-600">
                        <i class="fas fa-bomb mr-2"></i>拆分前
                    </h3>
                    <div class="code-block">
                        <pre><code>class OrderService {
    void create